export default {
    data() {
      return {
        fileList: [],
        fileList1: [],
        Url: "https://recruitr.guanyunart.com/api/recruitr/upload/uploadFile",
        InstructionOptions: [
          {
            label: this.$t('inst.InstructionOptions.LABELING'),
            value: "LABELING",
            fileName: "",
            fileUrl:
              "https://zjyg-yt.oss-cn-hangzhou.aliyuncs.com/scm/upload/20230921/xlsx/7239d6f501bb4358aedb60ab2646160c/换标登记表.xlsx",
          },
          {
            label: this.$t('inst.InstructionOptions.CHANGEBOX'),
            value: "CHANGEBOX",
            fileName: "",
            fileUrl: "",
          },
          {
            label: this.$t('inst.InstructionOptions.LABELCHANGE'),
            value: "LABELCHANGE",
            fileName: "",
            fileUrl:
              "https://zjyg-yt.oss-cn-hangzhou.aliyuncs.com/scm/upload/20230921/xlsx/7239d6f501bb4358aedb60ab2646160c/换标登记表.xlsx",
          },
          {
            label: this.$t('inst.InstructionOptions.DSORDER'),
            value: "DSORDER",
            fileName: "",
            fileUrl:
              "https://zjyg-yt.oss-cn-hangzhou.aliyuncs.com/scm/upload/20230921/xls/092b9403620e4be797de7e4aa3232713/DS订单拣货标模板.xls",
          },
          {
            label: this.$t('inst.InstructionOptions.RTVPICKUP'),
            value: "RTVPICKUP",
            fileName: "",
            fileUrl: "",
          },
          {
            label: this.$t('inst.InstructionOptions.CHANGEPRODUCT'),
            value: "CHANGEPRODUCT",
            fileName: "",
            fileUrl: "",
          },
          {
            label: this.$t('inst.InstructionOptions.DELIVERYFEE'),
            value: "DELIVERYFEE",
            fileName: "",
            fileUrl: "",
          },
          {
            label: this.$t('inst.InstructionOptions.stockAgeFee'),
            value: "stockAgeFee",
            fileName: "",
            fileUrl: "",
          },
          {
            label: this.$t('inst.InstructionOptions.warehouseOperationFee'),
            value: "warehouseOperationFee",
            fileName: "",
            fileUrl: "",
          },
          {
            label: this.$t('inst.InstructionOptions.materialCost'),
            value: "materialCost",
            fileName: "",
            fileUrl: "",
          },
        ],
      };
    },
    methods: {
      handleUploadSuccess(row) {
        return (response, file, fileList) => {
          // 将上传的文件信息赋值给相应行的对象
          row.fileName = file.name;
          row.files = file.response.data;
        };
      },
      handleUploadSuccess1(row) {
        return (response, file, fileList) => {
          // 将上传的文件信息赋值给相应行的对象
          row.receiptFileName = file.name;
          row.receiptFile = file.response.data;
        };
      },
      handleUploadError1() {
        this.uploadLoading = false;
        this.fileList1 = [];
        this.$message({
          type: "error",
          message: this.$t("common.failedMsg"),
        });
      },
      handleUploadError() {
        this.uploadLoading = false;
        this.fileList = [];
        this.$message({
          type: "error",
          message: this.$t("common.failedMsg"),
        });
      },
      filterFileName(fileName) {
        const maxLength = 22; // 最大长度，包括省略号
        let truncatedName = fileName;
        if (fileName && fileName.length > maxLength) {
          const prefixLength = Math.floor((maxLength - 3) / 2); // 前缀长度
          const suffixLength = maxLength - prefixLength - 3; // 后缀长度
          const prefix = fileName.substr(0, prefixLength);
          const suffix = fileName.substr(fileName.length - suffixLength);
          truncatedName = `${prefix}...${suffix}`;
          return truncatedName;
        }
      },
    },
  };
  